Ext.define('EF.controller.GeneralGrid', {
    extend: 'Ext.app.Controller',
    
    alias: 'widget.generalgrid',
    
    requires: ['EF.lib.Common'],
    
    views: ['GeneralGrid'],
    
    statics:{
		//对应的实体类
		EntityName: '',
	
		//动态创建GeneralGrid
		CreateGeneralGrid:function(title,entity){
			var successFun = function(json){
				Ext.define('GeneralGridModel',{
					extend: 'Ext.data.Model',
					fields: json.ModelFields
				});
				
				/*
				var gridStore = Ext.create('Ext.data.Store',{
					model: 'GeneralGridModel',
					proxy: {
						type:'ajax',
						reader:{
							type: 'json',
							root: ''
						},
						url:''
					},
					autoLoad: true
				});
				*/
				
				var grid = Ext.create('EF.view.GeneralGrid',{
					columns: json.GridColumns
					
				});
				
				var viewport = Ext.getCmp('viewport_center');
				viewport.removeAll();
				viewport.add(grid);
			}; 
			
			EF.lib.Common.CallServerFun('GeneralGrid', 'GetGeneralGridSchema', [entity], successFun);
		}
	}
});